Eclipse Platform
Pre-release 3.0

org.eclipse.ui.texteditor
Class MarkerAnnotation

java.lang.Object
  extended byorg.eclipse.jface.text.source.Annotation
      extended byorg.eclipse.ui.texteditor.MarkerAnnotation

public class MarkerAnnotation
extends Annotation

Annotation representing a marker on a resource in the workspace. This class may be instantiated or be subclassed.

See Also:
IMarker

Field Summary
static int PROBLEM_LAYER
          The layer in which markers representing problem are located.
 
Fields inherited from class org.eclipse.jface.text.source.Annotation
TYPE_UNKNOWN
 
Constructor Summary
MarkerAnnotation(IMarker marker)
          Creates a new annotation for the given marker.
MarkerAnnotation(String annotationType, IMarker marker)
          Creaets a new annotation of the given type for the given marker.
 
Method Summary
 boolean equals(Object o)
          The MarkerAnnotation implementation of this Object method returns true iff the other object is also a MarkerAnnotation and the marker handles are equal.
protected  Image getImage(Display display)
          Returns an image for this annotation.
protected static Image getImage(Display display, ImageDescriptor descriptor)
          Returns an image for the given display as specified by the given image descriptor.
protected  Image getImage(String name)
          Returns the image of the given name.
protected static Map getImageRegistry(Display display)
          Returns an image registry for the given display.
 IMarker getMarker()
          Returns this annotation's underlying marker.
 String getText()
          Returns the text associated with this annotation.
protected  String getUnknownImageName(IMarker marker)
          Returns the name of an image used to visually represent markers of unknown type.
 int hashCode()
           
protected  void initialize()
          Initializes the annotation's icon representation and its drawing layer based upon the properties of the underlying marker.
 void paint(GC gc, Canvas canvas, Rectangle r)
          Implement this method to draw a graphical representation of this annotation within the given bounds.
protected  void setImage(Image image)
          Sets the marker image to the given image.
 void update()
          Informs this annotation about changes applied to its underlying marker and adapts to those changes.
 
Methods inherited from class org.eclipse.jface.text.source.Annotation
drawImage, drawImage, getLayer, getType, isMarkedDeleted, isPersistent, markDeleted, setLayer, setText, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROBLEM_LAYER

public static final int PROBLEM_LAYER
The layer in which markers representing problem are located.

Since:
2.0 XXX to be deprecated as of 3.0 use DefaultAnnotation.ERROR_LAYER
See Also:
Constant Field Values
Constructor Detail

MarkerAnnotation

public MarkerAnnotation(IMarker marker)
Creates a new annotation for the given marker.

Parameters:
marker - the marker

MarkerAnnotation

public MarkerAnnotation(String annotationType,
                        IMarker marker)
Creaets a new annotation of the given type for the given marker.

Parameters:
annotationType - the annotation type
marker - the marker
Since:
3.0
Method Detail

getImage

protected static Image getImage(Display display,
                                ImageDescriptor descriptor)
Returns an image for the given display as specified by the given image descriptor.

Parameters:
display - the display
descriptor - the image descriptor
Returns:
an image for the display as specified by the descriptor

getImageRegistry

protected static Map getImageRegistry(Display display)
Returns an image registry for the given display. If no such registry exists the resgitry is created.

Parameters:
display - the display
Returns:
the image registry for the given display

setImage

protected void setImage(Image image)
Sets the marker image to the given image.

Parameters:
image - the new marker image

equals

public boolean equals(Object o)
The MarkerAnnotation implementation of this Object method returns true iff the other object is also a MarkerAnnotation and the marker handles are equal.


hashCode

public int hashCode()

getMarker

public IMarker getMarker()
Returns this annotation's underlying marker.

Returns:
the marker

initialize

protected void initialize()
Initializes the annotation's icon representation and its drawing layer based upon the properties of the underlying marker.


paint

public void paint(GC gc,
                  Canvas canvas,
                  Rectangle r)
Description copied from class: Annotation
Implement this method to draw a graphical representation of this annotation within the given bounds. This default implementation does nothing.

Overrides:
paint in class Annotation
Parameters:
canvas - the canvas to draw on
r - the bounds inside the canvas to draw on

update

public void update()
Informs this annotation about changes applied to its underlying marker and adapts to those changes.


getUnknownImageName

protected String getUnknownImageName(IMarker marker)
Returns the name of an image used to visually represent markers of unknown type. This implementation returns null. Subclasses may replace this method.

Parameters:
marker - the marker of unkown type
Returns:
the name of an image for markers of unknown type.

getImage

protected Image getImage(String name)
Returns the image of the given name. Subclasses may extend this method. If so, subclasses must assume responsibility for disposing the images they create.

Parameters:
name - the name of the requested image
Returns:
the image or null if there is no such image

getImage

protected Image getImage(Display display)
Returns an image for this annotation. It first consults the workbench adapter for this annotation's marker. If none is defined, it tries to find an image for the image name of this annotation.

Parameters:
display - the display for which the image is requested
Returns:
the image for this annotation

getText

public String getText()
Description copied from class: Annotation
Returns the text associated with this annotation.

Overrides:
getText in class Annotation
Returns:
the text associated with this annotation or null

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.